home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Everything For A Hacker
/
19990506-[HACK].iso
/
HEXEDIT
/
UTILS
/
ZENDISK1.ARJ
/
LST10-19.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-02-15
|
887b
|
36 lines
;
; *** Listing 10-19 ***
;
; Generates the 8-bit checksum of a 1000-byte array
; by loading both segment and offset from a far
; pointer each time through the loop and without
; using string instructions, as the code generated
; by a typical high-level language compiler would.
;
jmp Skip
;
FarSeg segment para
ARRAY_LENGTH equ 1000
ByteArray db ARRAY_LENGTH dup (0)
;this array resides in a
; far segment
FarSeg ends
;
FarPtr dd ByteArray ;a far pointer to the array
;
Skip:
call ZTimerOn
mov cx,ARRAY_LENGTH ;# of bytes to checksum
sub ah,ah ;zero the checksum counter
ChecksumLoop:
les bx,[FarPtr] ;load both segment and
; offset from the far
; pointer
inc word ptr [FarPtr]
;advance the offset portion
; of the far pointer
add ah,es:[bx] ;add the next byte to the
; checksum
loop ChecksumLoop
call ZTimerOff